
# Teacher Absenteeism -----------------------------------------------------

# Prescriptive Norm

elcb$repeat_absense_q10_7
el$repeat_absence <- NA
el$repeat_absence[el$repeat_absense_q10_7 == 2] <- 0
el$repeat_absence[el$repeat_absense_q10_7 == 1] <- 1

#this is 1 if they select community action, not govt pressure
elcb$community_state_q13_2 
el$community_state <- NA
el$community_state[el$community_state_q13_2 == 2] <- 0
el$community_state[el$community_state_q13_2 == 1] <- 1

#this is 1 if they select parent responsibility, not govt
elcb$gov_resp_q11_2
el$gov_resp <- NA
el$gov_resp[el$gov_resp_q11_2 == 2] <- 1
el$gov_resp[el$gov_resp_q11_2 == 1] <- 0




# Descriptive Norm

elcb$village_action_q10_8
el$village_action <- NA
el$village_action[el$village_action_q10_8 == 1] <- 0 
el$village_action[el$village_action_q10_8 == 2] <- 1 

# Efficacy
elcb$change_abs_q10_9
el$abs_efficacy <- NA
el$abs_efficacy[el$change_abs_q10_9 == 1] <- 0
el$abs_efficacy[el$change_abs_q10_9 == 2] <- 1


# Actual absenteeism 
elcb$absent_freq_yesno_q10_8 
elcb$absent_freq_yes_q10_9
elcb$absent_freq_no_q10_9
el$absent_frequency <- NA
el$absent_frequency[el$absent_freq_no_q10_9 == 2] <- 0 
  el$absent_frequency[el$absent_freq_no_q10_9 == 1] <- 1
  el$absent_frequency[el$absent_freq_yes_q10_9 == 1] <- 2
  el$absent_frequency[el$absent_freq_yes_q10_9 == 2] <- 3

# Activism around Teacher Absenteeism
  
elcb$teach_confronted_q10_9b
el$teacher_confronted <- NA
el$teacher_confronted[el$teach_confronted_q10_9b == 2] <- 0 
el$teacher_confronted[el$teach_confronted_q10_9b == 1] <- 1

elcb$students_from_q10_9c
el$students_from_tradingcenter <- NA
el$students_from_tradingcenter[el$students_from_q10_9c == 1] <- 1
el$students_from_tradingcenter[el$students_from_q10_9c == 2] <- 0

elcb$pta_freq_yesno_q10_10
elcb$pta_freq_yes_q10_11
elcb$pta_freq_no_q10_11
el$pta_frequency <- NA
el$pta_frequency[el$pta_freq_no_q10_11 == 2] <- 0
el$pta_frequency[el$pta_freq_no_q10_11 == 1] <- 1
el$pta_frequency[el$pta_freq_yes_q10_11 == 1] <- 2
el$pta_frequency[el$pta_freq_yes_q10_11 == 2] <-  3




# Goals -------------------------------------------------------------------

elcb$goals_q6_2

el$abs_goal <- as.numeric(grepl("4",el$goals_q6_2,T))
el$abs_goal[is.na(el$goals_q6_2)] <- NA


# Spending Priorities -----------------------------------------------------

elcb$gov_spend_q11_3
el$more_schools <- NA
el$more_schools <- (el$gov_spend_q11_3 == 3)*1 


# Discussion Outcomes -----------------------------------------------------

elcb$convers_q3_3

el$abs_discussion <- as.numeric(
  grepl(
    pattern = "7",
    x = el$convers_q3_3,
    ignore.case = TRUE
  ))
el$abs_discussion[is.na(el$convers_q3_3)] <- NA  



# Violence against women --------------------------------------------------

# IPV

elcb$intervene_q8_9
el$should_intervene <- NA
el$should_intervene[el$intervene_q8_9 == 2] <- 0
el$should_intervene[el$intervene_q8_9 == 1] <- 1

el$IPV_discussion <- as.numeric(grepl(
  pattern = "1 |1$",
  x = el$convers_q3_3,
  ignore.case = TRUE
))

el$IPV_discussion[el$convers_q3_3 == 1] <- 1
el$IPV_discussion[is.na(el$convers_q3_3)] <- NA


# Abortion ----------------------------------------------------------------

elcb$adult_complic_q12_9
el$should_help <- NA
el$should_help[el$adult_complic_q12_9 == 2] <- 0
el$should_help[el$adult_complic_q12_9 == 1] <- 1

el$abo_discussion <- as.numeric(
  grepl(
    pattern = "3",
    x = el$convers_q3_3,
    ignore.case = TRUE
  ))
el$abo_discussion[is.na(el$convers_q3_3)] <- NA


elcb$involved_q12_1
el$involved <- NA
el$involved[el$involved_q12_1 == 2] <- 1
el$involved[el$involved_q12_1 == 1] <- 0
